package com.xtkj.basedata.controller.export;

import com.alibaba.fastjson.JSONArray;
import com.xtkj.basedata.repository.export.CityRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Api
public class CityController {

    @Resource
    CityRepository cityRepository;

    @RequestMapping(value = "getCityById/{id}",method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(value="根据城市id查找id", notes="返回字符串")
    @ApiImplicitParam(name = "id", value = "id", dataType = "Long")
    public String getString(@PathVariable Long id){
         return JSONArray.toJSONString(cityRepository.findById(id));
    }

}
